<template>
	<view class="box_center">
		<view class="header">
			<view class="class-search">
				<u-search placeholder="请输入关键字" v-model="val" animation="false" @search="searchname" @clear="clearname">
				</u-search>
			</view>
		</view>
		<view class="bidding-item" v-for="(item,index) in list" :key="index" @click="details(item)">
			<view class="item-title">
				<image src="@/static/image/bidding/status3.png" mode=""></image>
				<text>{{item.bidding_name}}</text>
			</view>
			<view class="item-company">
				{{item.company_id_name}}
			</view>
			<view class="item-date">
				{{item.create_date}}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getBiddingList,
		getBiddingList2,
		getBiddingList3
	} from '@/static/js/api/bidding.js';
	import {share} from '@/mixins/index.js'
	export default {
		mixins:[share],
		onLoad(option) {
			this.getdata()
		},
		data() {
			return {
				list: [],
				val: ''
			}
		},
		methods: {
			details(val) {
				let value = JSON.stringify(val)
				var id = JSON.stringify(val.id)
				uni.navigateTo({
					url: `/pages/home/job/jobdetails?id=${id}`
				})
			},
			getdata(val) {
				var search_val = val ? val : ''
				getBiddingList3(1, 999, search_val).then(res => {
					this.list = res.data
				})
			},
			searchname(val) {
				getBiddingList2(1, 999, val).then(res => {
					this.list = res.data
				})
			},
			clearname() {
				this.getdata()
			},
			recruitment() {
				let userInfo = JSON.parse(uni.getStorageSync('userInfo'));
				let isVerified = uni.getStorageSync('isVerified');
				if (!isVerified) {
					uni.showModal({
						title: '提示',
						content: '请先完成实名认证',
						success(r) {
							if (r.confirm) {
								uni.navigateTo({
									url: '/pages/main/mine/MineRegisterIdentity'
								})
							}
						}
					})
					return;
				}
				if (userInfo.account_type == '班组长' || userInfo.account_type == '劳务企业管理人员') {
					uni.navigateTo({
						url: "/pages/home/job/GetJob"
					})
				} else {
					uni.showToast({
						icon: 'none',
						title: '请先注册成为班组长或者劳务企业'
					})
				}
			},
			lookingJob() {
				let isVerified = uni.getStorageSync('isVerified');
				if (!isVerified) {
					uni.showModal({
						title: '提示',
						content: '请先完成实名认证',
						success(r) {
							if (r.confirm) {
								uni.navigateTo({
									url: '/pages/main/mine/MineRegisterIdentity'
								})
							}
						}
					})
					return;
				}
				uni.navigateTo({
					url: "/pages/home/job/SetJob"
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.box_center {
		width: 100vw;
		height: 100%;
		background-color: #F4F5F9;
	}
	.header {
		width: 100%;
		// height: 80rpx;
		background-color: #FFFFFF;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx 22rpx;

		.class-search {
			width: 100%;
			// margin-left: 20rpx;
			background-color: #EEEEEE;
			// width: 50%;
			height: 60rpx;
			border-radius: 20rpx;
			display: flex;
			text-align: left;
			align-items: center;

			.image-search {
				width: 44rpx;
				height: 44rpx;
				margin-right: 12rpx;
			}

			&>input {
				flex: 1;
				font-size: 28rpx;
				font-weight: 400;
				color: #666666;
				line-height: 40rpx;
			}

			.placeholder-input {
				font-size: 28rpx;
				font-weight: 400;
				color: #666666;
				line-height: 40rpx;
			}
		}
	}

	.bidding-item {
		background: #FFFFFF;
		padding: 36rpx 30rpx;
		position: relative;
		margin-top: 20rpx;
	}

	.item-title {
		image {
			width: 120rpx;
			height: 38rpx;
			margin-bottom: -5rpx;
			margin-right: 20rpx;
		}

		text {
			font-size: 32rpx;
			font-weight: 500;
			color: #333333;
		}
	}

	.item-label {
		display: flex;
		align-items: center;
		margin-top: 18rpx;
		flex-wrap: wrap;

		.item-label-item {
			padding: 0 16rpx;
			height: 40rpx;
			line-height: 40rpx;
			background: #F4F5F9;
			border-radius: 6rpx;
			font-size: 24rpx;
			font-weight: 400;
			color: #666666;
			margin-right: 20rpx;
			margin-top: 10rpx;
		}
	}

	.item-company {
		font-size: 26rpx;
		font-weight: 400;
		margin-top: 34rpx;
		color: #666666;
		max-width: 312rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.item-date {
		position: absolute;
		right: 30rpx;
		bottom: 36rpx;

		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	/deep/.u-action {
		display: none;
	}
	
	/deep/u-search{
		width: 100%;
	}
</style>
